#ifndef __stock
#define __stock

#include <string>
#include "random.h"

struct stock {
  
  std::string name; // name of stock eg., BARC, RBS etc
  
  double price; // current price
  double initial; // price at start of program
  double change; // price change since last price
  double total_change; // price change since start of program
  
  double volatility; // volatility (stock moves randomly up or down by volatility units)
  rnd<double> dice; // returns a number between 0 and volatility 
  
  // price updates n times in m seconds
  int n_times;
  int m_secs;
  
  double update; // price changes every update seconds; calculated from n_times & m_secs
  double last_change; // time of last price change
  
  stock (const std::string& n, double _price, double _volatility, int _n_times, int _m_secs);
  int tick (double time_now);
    
};

#endif
